const { expect, use } = require('chai');
const { BigNumber } = require('ethers');
const { deployContract, MockProvider, solidity } = require('ethereum-waffle');
const { ethers, upgrades } = require("hardhat");

use(solidity);

describe("Test Lottery.randomNFT Interface", function () {
    var OWNER;
    var ADDR1;
    var StruggleDog;
    beforeEach(async () => {
        [OWNER, ADDR1] = await ethers.getSigners();
        const nftName = "testDog";
        const nftSymbol = "Gog";
        const nftUrl = "https://nftswap-hm.oss-cn-chengdu.aliyuncs.com/metadata/";
        const SRtotalSupply = 2000;
        const SSRTotalSupply = 3000;
        const URTotalSupply = 5000;
        const nftStruggleDogParser = await ethers.getContractFactory("StruggleDog",OWNER);
        StruggleDog = await nftStruggleDogParser.deploy(SRtotalSupply,SSRTotalSupply, URTotalSupply, nftName, nftSymbol, nftUrl);
    });


    it("Should be mint struggleDog NFT successful;", async function () {
        const mintNFT1 = await StruggleDog.connect(OWNER).mint(ADDR1.address, 1, 1);
        await mintNFT1.wait();
        const mintNFT2 = await StruggleDog.connect(OWNER).mint(ADDR1.address, 2, 1);
        await mintNFT2.wait();
        var receipt = await ethers.provider.getTransactionReceipt(mintNFT1.hash);
        expect(receipt.status).to.equal(1);
    });

    it("should get nft URL", async function () {
        const mintNFT1 = await StruggleDog.connect(OWNER).mint(ADDR1.address, 1, 1);
        const tokenUrl = await StruggleDog.connect(OWNER).tokenURI(1);
        console.log(tokenUrl);
    })
});
